/**
 * 初始化系统参数详情对话框
 */
var EntranceGuardRuleInfoDetail = {
    entranceGuardRuleInfoDetailData : {},
    doorTree: null,
    userTree: null
};

/**
 * 关闭此对话框
 */
EntranceGuardRuleInfoDetail.close = function() {
    parent.layer.close(window.parent.EntranceGuardRule.layerIndex);
}


var setting = {view: {selectedMulti:false,nameIsHTML:true,showTitle:false,dblClickExpand:false},
    data: {simpleData: {enable: true}}};

$(function() {
    //初始化已分配门树
    $.get(Feng.ctxPath + "/door/ENTRANCE/GUARD/RULE/selectDoorForRule?id=" + $("[id='id']").val(), function(doorNodes){
        for (var i = 0; i < doorNodes.length; i++) {
            // doorNodes[i].name = "<font color='red' style='font-weight:bold;'>" + doorNodes[i].id + "-" + doorNodes[i].name + "</font>";
            doorNodes[i].name = doorNodes[i].doorName;

        }
        EntranceGuardRuleInfoDetail.doorTree = $.fn.zTree.init($("#doorTree"), setting, doorNodes);
    });

    //初始化已分配人员树
    $.get(Feng.ctxPath + "/door/ENTRANCE/GUARD/RULE/selectUserForRule?id=" + $("[id='id']").val(), function(userNodes){
        for (var i = 0; i < userNodes.length; i++) {
            userNodes[i].name = userNodes[i].id + "-" + userNodes[i].name;
        }
        EntranceGuardRuleInfoDetail.userTree = $.fn.zTree.init($("#userTree"), setting, userNodes);
    });
});
